package mk.jug.academy.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

import mk.jug.academy.model.status.StudentStatus;


/**
 * Domain model representing a {@link Student} in the Java Academy.
 * One student can visit multiple {@link Course}s at once.
 * 
 * @author Ice.Penov
 */
@Entity @SuppressWarnings("serial")
public class Student extends User {
	
	public static final String CODE_PREFIX = "STD-";
	
	public Student() {
		setRole(UserType.STUDENT.toString());
	}
	
	@Column(nullable = false)
	private String firstName;	
	
	@Column(nullable = false)
	private String lastName;	
	
	@Column
	private String bio;
	
	@Column
	private String reasonForSigningUp;
	
	@Column @Enumerated(EnumType.STRING)
	private StudentStatus status;
	
	@Column
	private Long courseID;
	
	@Column
	private String courseName;
	
	@Override
	public String getDisplayName() {
		return firstName + " " + lastName;
	}
	
	/**
	 * The code identifier of the entity. 
	 */
	public String getCode() {
		return CODE_PREFIX + getId();
	}
	
	/**
	 * Returns the bio.
	 */
	public String getBio() {
		return bio;
	}

	/**
	 * Setter for the bio.
	 */
	public void setBio(String bio) {
		this.bio = bio;
	}

	/**
	 * Returns the reasonForSigningUp.
	 */
	public String getReasonForSigningUp() {
		return reasonForSigningUp;
	}

	/**
	 * Setter for the reasonForSigningUp.
	 */
	public void setReasonForSigningUp(String reasonForSigningUp) {
		this.reasonForSigningUp = reasonForSigningUp;
	}

	/**
	 * Returns the status.
	 */
	public StudentStatus getStatus() {
		return status;
	}

	/**
	 * Setter for the status.
	 */
	public void setStatus(StudentStatus status) {
		this.status = status;
	}

	/**
	 * Returns the firstName.
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * Setter for the firstName.
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * Returns the lastName.
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * Setter for the lastName.
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * Returns the courseID.
	 */
	public Long getCourseID() {
		return courseID;
	}

	/**
	 * Setter for the courseID.
	 */
	public void setCourseID(Long courseID) {
		this.courseID = courseID;
	}

	/**
	 * Returns the courseName.
	 */
	public String getCourseName() {
		return courseName;
	}

	/**
	 * Setter for the courseName.
	 */
	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}	
	
}